package com.gitee.wsl.mathematics.coordinate.ext

import com.gitee.wsl.mathematics.coordinate.d2.Coordinate2
import com.gitee.wsl.mathematics.coordinate.d3.Coordinate3
import com.gitee.wsl.mathematics.vector.ext.cross
import com.gitee.wsl.mathematics.vector.ext.dot

infix fun<T:Number> Coordinate2<T, *>.angleTo(other: Coordinate2<T, *>):T = acos(dot(other) / (length * other.length))
infix fun<T:Number> Coordinate2<T, *>.angleTo(other: Coordinate3<T, *>):T = other angleTo this

infix fun<T:Number> Coordinate3<T, *>.angleTo(other: Coordinate2<T, *>):T = atan2(cross(other).length, dot(other))
//infix fun<T:Number,V:Coordinate3<T, V>> Coordinate3<T, V>.angleTo(other: Coordinate3<T, V>):T = atan2(cross(other).length, dot(other))
infix fun<T:Number> Coordinate3<T,*>.angleTo(other: Coordinate3<T, *>):T = atan2(cross(other).length, dot(other))

